﻿package  {
	
	import com.sorayume.script.SY_Chapter;
	import flash.display.MovieClip;
	
	import com.sorayume.script.SY_Script;
	import com.sorayume.core.SY_Event;
	
	public class yagarasu_tests extends MovieClip {
		
		var syScript:SY_Script = null;
		
		public function yagarasu_tests() {
			// constructor code
			
			syScript = new SY_Script();
			syScript.addEventListener(SY_Event.ON_ERROR, hndError);
			
			trace("Cargar XML");
			syScript.loadXML("prueba.syml");
			syScript.addEventListener(SY_Event.ON_XML_LOADED, doDump);
			
		}
		
		private function doDump(e:SY_Event):void 
		{
			trace("XML cargado");
			var testChapter:SY_Chapter = syScript.getChapter("Siescucho");
			//trace(testChapter.cmdAt(1).name());
			//trace(syScript.getFirstChapeterId());
			trace(syScript.execThis(testChapter.cmdAt(1)));
		}
		
		private function hndError(e:SY_Event):void 
		{
			trace("ERROR: ");
			trace(" " + e.params.desc);
		}
		
	}
	
}